From: Carlos Soriano Date: Thu, 3 Jul 2014 13:33:09 +0000 (+0200) Subject: overview: Reorder functions for better context X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2360 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4a39af7f98640853411d263b889da2c0619f67ec;p=gnome-shell.git overview: Reorder functions for better context --- diff --git a/js/ui/overview.js b/js/ui/overview.js index 05e4bd142..5bf114dd0 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -455,23 +455,6 @@ const Overview = new Lang.Class({ this._inDrag = false; }, - // show: - // - // Animates the overview visible and grabs mouse and keyboard input - show: function() { - if (this.isDummy) - return; - if (this._shown) - return; - this._shown = true; - - if (!this._syncGrab()) - return; - - Main.layoutManager.showOverview(); - this._animateVisible(); - }, - focusSearch: function() { this.show(); this._searchEntry.grab_key_focus(); @@ -504,6 +487,69 @@ const Overview = new Lang.Class({ }); }, + // Checks if the Activities button is currently sensitive to + // clicks. The first call to this function within the + // OVERVIEW_ACTIVATION_TIMEOUT time of the hot corner being + // triggered will return false. This avoids opening and closing + // the overview if the user both triggered the hot corner and + // clicked the Activities button. + shouldToggleByCornerOrButton: function() { + if (this.animationInProgress) + return false; + if (this._inDrag) + return false; + if (this._activationTime == 0 || Date.now() / 1000 - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT) + return true; + return false; + }, + + _syncGrab: function() { + // We delay grab changes during animation so that when removing the + // overview we don't have a problem with the release of a press/release + // going to an application. + if (this.animationInProgress) + return true; + + if (this._shown) { + let shouldBeModal = !this._inXdndDrag; + if (shouldBeModal) { + if (!this._modal) { + if (Main.pushModal(this._overview, + { keybindingMode: Shell.KeyBindingMode.OVERVIEW })) { + this._modal = true; + } else { + this.hide(); + return false; + } + } + } + } else { + if (this._modal) { + Main.popModal(this._overview); + this._modal = false; + } + } + return true; + }, + + // show: + // + // Animates the overview visible and grabs mouse and keyboard input + show: function() { + if (this.isDummy) + return; + if (this._shown) + return; + this._shown = true; + + if (!this._syncGrab()) + return; + + Main.layoutManager.showOverview(); + this._animateVisible(); + }, + + _animateVisible: function() { if (this.visible || this.animationInProgress) return; @@ -531,6 +577,20 @@ const Overview = new Lang.Class({ this.emit('showing'); }, + _showDone: function() { + this.animationInProgress = false; + this._desktopFade.hide(); + this._coverPane.hide(); + + this.emit('shown'); + // Handle any calls to hide* while we were showing + if (!this._shown) + this._animateNotVisible(); + + this._syncGrab(); + global.sync_pointer(); + }, + // hide: // // Reverses the effect of show() @@ -557,60 +617,6 @@ const Overview = new Lang.Class({ this._syncGrab(); }, - toggle: function() { - if (this.isDummy) - return; - - if (this.visible) - this.hide(); - else - this.show(); - }, - - // Checks if the Activities button is currently sensitive to - // clicks. The first call to this function within the - // OVERVIEW_ACTIVATION_TIMEOUT time of the hot corner being - // triggered will return false. This avoids opening and closing - // the overview if the user both triggered the hot corner and - // clicked the Activities button. - shouldToggleByCornerOrButton: function() { - if (this.animationInProgress) - return false; - if (this._inDrag) - return false; - if (this._activationTime == 0 || Date.now() / 1000 - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT) - return true; - return false; - }, - - _syncGrab: function() { - // We delay grab changes during animation so that when removing the - // overview we don't have a problem with the release of a press/release - // going to an application. - if (this.animationInProgress) - return true; - - if (this._shown) { - let shouldBeModal = !this._inXdndDrag; - if (shouldBeModal) { - if (!this._modal) { - if (Main.pushModal(this._overview, - { keybindingMode: Shell.KeyBindingMode.OVERVIEW })) { - this._modal = true; - } else { - this.hide(); - return false; - } - } - } - } else { - if (this._modal) { - Main.popModal(this._overview); - this._modal = false; - } - } - return true; - }, _animateNotVisible: function() { if (!this.visible || this.animationInProgress) @@ -636,20 +642,6 @@ const Overview = new Lang.Class({ this.emit('hiding'); }, - _showDone: function() { - this.animationInProgress = false; - this._desktopFade.hide(); - this._coverPane.hide(); - - this.emit('shown'); - // Handle any calls to hide* while we were showing - if (!this._shown) - this._animateNotVisible(); - - this._syncGrab(); - global.sync_pointer(); - }, - _hideDone: function() { // Re-enable unredirection Meta.enable_unredirect_for_screen(global.screen); @@ -675,6 +667,16 @@ const Overview = new Lang.Class({ this._fakePointerEvent(); this._needsFakePointerEvent = false; } + }, + + toggle: function() { + if (this.isDummy) + return; + + if (this.visible) + this.hide(); + else + this.show(); } }); Signals.addSignalMethods(Overview.prototype);